package com.springboot.cloud.seckill.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.script.DefaultRedisScript;

/**
 * @author godyao
 * @date 2022/3/26
 */
@Configuration
public class RedisScriptConfig {
    @Bean
    public DefaultRedisScript<Boolean> unlock() {
        final DefaultRedisScript<Boolean> unlockScript = new DefaultRedisScript<>();
        unlockScript.setLocation(new ClassPathResource("unlock.lua"));
        unlockScript.setResultType(Boolean.class);
        return unlockScript;
    }
}
